<%@page import="com.zqc.UserMassage"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="lianjie.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		request.setCharacterEncoding("UTF-8");
		UserMassage user = new UserMassage();
		String id = request.getParameter("id");
		String password = request.getParameter("password");
		String sql = "select * from usermassage where ID='" + id + "'";
		Statement sta = conn.createStatement();
		rs = sta.executeQuery(sql);
		if (rs != null && rs.next()) {
			user.setUser_id(rs.getString("ID"));
			user.setUser_name(rs.getString("username"));
			user.setUser_psw(rs.getString("password"));
			user.setUser_kind(rs.getString("kind"));
			out.print(user.getUser_kind());
			user.setUser_sex(rs.getString("sex"));
			user.setUser_tel(rs.getString("tel"));
			
			if(user.getUser_psw().equals(password)){
				out.println("登陆成功");
				session.setAttribute("se_Name",user.getUser_name() );
				session.setAttribute("se_Dlm",user.getUser_id() );
				session.setAttribute("se_Tel",user.getUser_tel() );
				session.setAttribute("se_Sex",user.getUser_sex() );
				
				if(user.getUser_kind().equals("1")){
					
					response.setHeader("Refresh", "0;URL=teacher.jsp");
				}else{
					response.setHeader("Refresh", "0;URL=student.jsp");
				}
			}
			else{
				out.println("用户名密码错误,请重新输入");
				response.setHeader("Refresh", "3;URL=aa_login.jsp");
			}
			
		} else {
			out.println("用户名不存在,请重新输入");
			response.setHeader("Refresh", "3;URL=aa_login.jsp");
		}
	%>
</body>
</html>